home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / HFORM.XS_ / hform.xsl
Encoding:
Extensible Markup Language  |  2003-02-21  |  4.8 KB  |  120 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
  4.  
  5. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  6.  
  7. <xsl:template match="RESULTS">
  8. <H3>Node: <xsl:value-of select="@NODE"/> - <xsl:value-of select="count(CIM/INSTANCE)"/> Instances of <xsl:value-of select="CIM/INSTANCE[1]/@CLASSNAME"/></H3>
  9. <table border="1">
  10. <xsl:for-each select="CIM/INSTANCE">
  11.     <xsl:sort select="PROPERTY[@NAME='Name']|PROPERTY.ARRAY[@NAME='Name']|PROPERTY.REFERENCE[@NAME='name']"/>
  12.     <tr style="background-color:#a0a0ff;font:10pt Tahoma;font-weight:bold;" align="left"><td colspan="2">
  13.     <xsl:choose>
  14.         <xsl:when test="PROPERTY[@NAME='Name']|PROPERTY.ARRAY[@NAME='Name']|PROPERTY.REFERENCE[@NAME='name']">
  15.             <xsl:value-of select="PROPERTY[@NAME='Name']|PROPERTY.ARRAY[@NAME='Name']|PROPERTY.REFERENCE[@NAME='name']"/>
  16.         </xsl:when>
  17.         <xsl:when test="PROPERTY[@NAME='Description']|PROPERTY.ARRAY[@NAME='Description']|PROPERTY.REFERENCE[@NAME='Description']">
  18.             <xsl:value-of select="PROPERTY[@NAME='Description']|PROPERTY.ARRAY[@NAME='Description']|PROPERTY.REFERENCE[@NAME='Description']"/>
  19.         </xsl:when>
  20.  
  21.         <xsl:otherwise>INSTANCE</xsl:otherwise>
  22.     </xsl:choose>
  23.  
  24.     <span style="height:1px;overflow-y:hidden">.</span></td></tr>
  25.     <tr style="background-color:#c0c0c0;font:8pt Tahoma;">
  26.     <td>Property Name</td><td>Value</td>
  27.     </tr>
  28.  
  29.     <xsl:for-each select="PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE">
  30.         <xsl:variable name="typevar" select="@TYPE"/>
  31.         <xsl:choose>
  32.             <xsl:when test="position() mod 2 < 1">
  33.                 <tr style="background-color:#e0f0f0;font:10pt Tahoma;">
  34.                 <td>
  35.                     <xsl:value-of select="@NAME"/>
  36.                 </td>
  37.                 <td>
  38.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  39.                     <xsl:apply-templates select=".">
  40.                         <xsl:with-param name="type">
  41.                             <xsl:value-of select="$typevar"/>
  42.                         </xsl:with-param>
  43.                     </xsl:apply-templates>
  44.                 </xsl:for-each>
  45.                 <span style="height:1px;overflow-y:hidden">.</span>
  46.                 </td>
  47.                 </tr>
  48.             </xsl:when>
  49.             <xsl:otherwise>
  50.                 <tr style="background-color:#f0f0f0;font:10pt Tahoma;">
  51.                 <td>
  52.                     <xsl:value-of select="@NAME"/>
  53.                 </td>
  54.                 <td>
  55.                 <xsl:for-each select="VALUE|VALUE.ARRAY|VALUE.REFERENCE">
  56.                     <xsl:apply-templates select=".">
  57.                         <xsl:with-param name="type">
  58.                             <xsl:value-of select="$typevar"/>
  59.                         </xsl:with-param>
  60.                     </xsl:apply-templates>
  61.                 </xsl:for-each>
  62.                 <span style="height:1px;overflow-y:hidden">.</span>
  63.                 </td>
  64.                 </tr>
  65.             </xsl:otherwise>
  66.         </xsl:choose>
  67.  
  68.     </xsl:for-each>
  69.  
  70.     <tr style="background-color:#ffffff;font:10pt Tahoma;font-weight:bold;"><td colspan="2"><span style="height:1px;overflow-y:hidden">.</span></td></tr>
  71. </xsl:for-each>
  72. </table>
  73. </xsl:template>
  74.  
  75. <xsl:template match="VALUE.ARRAY">
  76.     <xsl:param name="type"/>
  77.     {<xsl:for-each select="VALUE">
  78.         <xsl:apply-templates select=".">
  79.             <xsl:with-param name="type">
  80.                 <xsl:value-of select="$type"/>
  81.             </xsl:with-param>
  82.             <xsl:with-param name="isarray">true</xsl:with-param>
  83.             <xsl:with-param name="includequotes">true</xsl:with-param>
  84.         </xsl:apply-templates>
  85.         <xsl:if test="position()!=last()">,</xsl:if>
  86.     </xsl:for-each>}
  87. </xsl:template>
  88. <xsl:template match="VALUE">
  89.     <xsl:param name="type"/>
  90.     <xsl:param name="includequotes"/>
  91.     <xsl:param name="isarray"/>
  92.     <xsl:choose>
  93.         <xsl:when test="$type='string'">
  94.             <xsl:if test="$includequotes='true'">"</xsl:if><xsl:value-of select="."/><xsl:if test="$includequotes='true'">"</xsl:if>
  95.         </xsl:when>
  96.         <xsl:when test="$type='char16'">
  97.             '<xsl:value-of select="."/>'
  98.         </xsl:when>
  99.         <xsl:when test="$type='uint16'or $type='uint32' or $type='uint64' or $type='uint8' or $type='real32'or $type='real64' or $type='sint16'or $type='sint32' or $type='sint64' or $type='sint8'">
  100.             <xsl:if test="$isarray='true'"><xsl:value-of select="."/></xsl:if>
  101.             <xsl:if test="not($isarray='true')"><div align="right"><xsl:value-of select="."/></div></xsl:if>
  102.         </xsl:when>
  103.         <xsl:otherwise>
  104.             <xsl:value-of select="."/>
  105.         </xsl:otherwise>
  106.     </xsl:choose>
  107. </xsl:template>
  108.  
  109. <xsl:template match="VALUE.REFERENCE"><xsl:apply-templates select="INSTANCEPATH/NAMESPACEPATH"/><xsl:apply-templates select="INSTANCEPATH/INSTANCENAME|INSTANCENAME"/></xsl:template>
  110.  
  111. <xsl:template match="NAMESPACEPATH">\\<xsl:value-of select="HOST/text()"/><xsl:for-each select="LOCALNAMESPACEPATH/NAMESPACE">\<xsl:value-of select="@NAME"/></xsl:for-each>:</xsl:template>
  112.  
  113. <xsl:template match="INSTANCENAME"><xsl:value-of select="@CLASSNAME"/><xsl:for-each select="KEYBINDING"><xsl:if test="position()=1">.</xsl:if><xsl:value-of select="@NAME"/>="<xsl:value-of select="KEYVALUE/text()"/>"<xsl:if test="position()!=last()">,</xsl:if></xsl:for-each></xsl:template>
  114.  
  115. <xsl:template match="/" >
  116. <html>
  117. <xsl:apply-templates select="COMMAND/RESULTS"/>
  118. </html>
  119. </xsl:template>
  120. </xsl:stylesheet>